<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <!--      <el-form-item label="标地名称" prop="auctionName">
              <el-input
                v-model="queryParams.auctionName"
                placeholder="请输入标地名称"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="拍卖类型" prop="auctionType">
              <el-select v-model="queryParams.auctionType" placeholder="请选择拍卖类型" clearable>
                <el-option
                  v-for="dict in dict.type.auction_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="区域" prop="auctionArea">
              <el-input
                v-model="queryParams.auctionArea"
                placeholder="请输入区域"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="标的所在地" prop="auctionAddress">
              <el-input
                v-model="queryParams.auctionAddress"
                placeholder="请输入标的所在地"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="资产类型" prop="auctionAssets">
              <el-select v-model="queryParams.auctionAssets" placeholder="请选择资产类型" clearable>
                <el-option
                  v-for="dict in dict.type.asset_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>-->
      <el-form-item label="所属城市" prop="cityId">
        <el-select v-model="queryParams.provinceId" placeholder="请选择省份"
                   @change="getCityList(queryParams.provinceId)"
                   style="width: 108px"
                   clearable>
          <el-option
            v-for="dict in provinces"
            :key="dict.id"
            :label="dict.name"
            :value="dict.id"
          />
        </el-select>
        <el-select v-model="queryParams.cityId" placeholder="请选择城市"
                   :disabled="queryParams.provinceId==null||queryParams.provinceId===''"
                   style="width: 107px"
                   clearable>
          <el-option
            v-for="dict in citys"
            :key="dict.id"
            :label="dict.name"
            :value="dict.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="拍卖状态" prop="auctionState">
        <el-select v-model="queryParams.auctionState" placeholder="请选择拍卖状态" clearable>
          <el-option
            v-for="dict in dict.type.auction_state"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="拍卖阶段" prop="auctionStage">-->
      <!--        <el-select v-model="queryParams.auctionStage" placeholder="请选择拍卖阶段" clearable>-->
      <!--          <el-option-->
      <!--            v-for="dict in dict.type.auction_stage"-->
      <!--            :key="dict.value"-->
      <!--            :label="dict.label"-->
      <!--            :value="dict.value"-->
      <!--          />-->
      <!--        </el-select>-->
      <!--      </el-form-item>-->
      <el-form-item label="上拍时间" prop="auctionTime">
        <el-date-picker clearable
                        v-model="queryParams.auctionTime"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择上拍时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="价格区间" prop="auctionPrice">
        <el-input
          v-model="queryParams.auctionPriceLower"
          placeholder="请输入价格下限"
          style="width: 45%"
          clearable
          @keyup.enter.native="handleQuery"
        />
        —
        <el-input
          v-model="queryParams.auctionPriceUpper"
          placeholder="请输入价格上限"
          style="width: 45%"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="审核状态" prop="approvalState">
        <el-select v-model="queryParams.approvalState" placeholder="请选择审核状态" clearable>
          <el-option
            v-for="dict in dict.type.audit_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!--      <el-form-item label="园区ID" prop="parkId">
              <el-select v-model="queryParams.parkId" placeholder="请选择园区ID" clearable>
                <el-option
                  v-for="dict in dict.type.sys_user_sex"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="所属城市ID" prop="cityId">
              <el-input
                v-model="queryParams.cityId"
                placeholder="请输入所属城市ID"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="浏览量" prop="pageView">
              <el-input
                v-model="queryParams.pageView"
                placeholder="请输入浏览量"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="是否收藏0否1是" prop="collectState">
              <el-select v-model="queryParams.collectState" placeholder="请选择是否收藏0否1是" clearable>
                <el-option
                  v-for="dict in dict.type.sys_yes_no"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="是否明星推荐0否1是" prop="recState">
              <el-select v-model="queryParams.recState" placeholder="请选择是否明星推荐0否1是" clearable>
                <el-option
                  v-for="dict in dict.type.recommend"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="预定状态0未预定1已预定" prop="reserveState">
              <el-select v-model="queryParams.reserveState" placeholder="请选择预定状态0未预定1已预定" clearable>
                <el-option
                  v-for="dict in dict.type.reserve_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="园区推荐状态0否1是" prop="recomState">
              <el-select v-model="queryParams.recomState" placeholder="请选择园区推荐状态0否1是" clearable>
                <el-option
                  v-for="dict in dict.type.recommend"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="封面资源http:p1" prop="coverResource">
              <el-input
                v-model="queryParams.coverResource"
                placeholder="请输入封面资源http:p1"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="联系人" prop="contactName">
              <el-input
                v-model="queryParams.contactName"
                placeholder="请输入联系人"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="联系方式" prop="servicePhone">
              <el-input
                v-model="queryParams.servicePhone"
                placeholder="请输入联系方式"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="联系方式" prop="contactPhone">
              <el-input
                v-model="queryParams.contactPhone"
                placeholder="请输入联系方式"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="发布人用户ID" prop="supplyUserId">
              <el-input
                v-model="queryParams.supplyUserId"
                placeholder="请输入发布人用户ID"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="审核状态：0待审核1审核通过2审核失败" prop="approvalState">
              <el-input
                v-model="queryParams.approvalState"
                placeholder="请输入审核状态：0待审核1审核通过2审核失败"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="审核备注" prop="approvalNote">
              <el-input
                v-model="queryParams.approvalNote"
                placeholder="请输入审核备注"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="备注" prop="note">
              <el-input
                v-model="queryParams.note"
                placeholder="请输入备注"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="排序" prop="sort">
              <el-input
                v-model="queryParams.sort"
                placeholder="请输入排序"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="状态0有效1失效" prop="state">
              <el-input
                v-model="queryParams.state"
                placeholder="请输入状态0有效1失效"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="是否删除0否1是" prop="dr">
              <el-input
                v-model="queryParams.dr"
                placeholder="请输入是否删除0否1是"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>
            <el-form-item label="是否置顶0：否1：是" prop="top">
              <el-input
                v-model="queryParams.top"
                placeholder="请输入是否置顶0：否1：是"
                clearable
                @keyup.enter.native="handleQuery"
              />
            </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['myIndustry:auction:add']"
        >新增</el-button>
      </el-col>
      <!--      <el-col :span="1.5">
              <el-button
                type="success"
                plain
                icon="el-icon-edit"
                size="mini"
                :disabled="single"
                @click="handleUpdate"
                v-hasPermi="['myIndustry:auction:edit']"
              >修改</el-button>
            </el-col>
            -->
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['myIndustry:auction:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['myIndustry:auction:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="auctionList" @selection-change="handleSelectionChange" height="410" fixed>
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="ID" align="center" prop="id" width="50"/>
      <el-table-column label="标地名称" align="center" prop="auctionName" />
      <el-table-column label="拍卖类型" align="center" prop="auctionType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.auction_type" :value="scope.row.auctionType"/>
        </template>
      </el-table-column>
      <el-table-column label="资产类型" align="center" prop="auctionAssets">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.asset_type" :value="scope.row.auctionAssets"/>
        </template>
      </el-table-column>
      <el-table-column label="区域" align="center" prop="auctionArea" />
      <el-table-column label="拍卖状态" align="center" prop="auctionState">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.auction_state" :value="scope.row.auctionState"/>
        </template>
      </el-table-column>
      <!--      <el-table-column label="标的所在地" align="center" prop="auctionAddress" />-->
      <el-table-column label="拍卖阶段" align="center" prop="auctionStage">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.auction_stage" :value="scope.row.auctionStage"/>
        </template>
      </el-table-column>
      <el-table-column label="上拍时间" align="center" prop="auctionTime" width="100">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auctionTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="起拍价格（元）" align="center" prop="auctionPriceLower" width="115"/>
      <el-table-column label="保证金（元）" align="center" prop="auctionPriceUpper" width="100"/>
      <el-table-column label="关联园区" align="center" prop="parkName" />
      <!--        <template slot-scope="scope">-->
      <!--          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.parkId"/>-->
      <!--        </template>-->
      <el-table-column label="所属城市" align="center" prop="cityName" />
      <el-table-column label="建筑总面积" align="center" prop="allSize" width="90"/>
<!--      <el-table-column label="空置面积" align="center" prop="parkFreeSize" />-->
      <el-table-column label="发布类型" align="center" prop="releaseType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.announce_type" :value="scope.row.releaseType"/>
        </template>
      </el-table-column>
      <!--      <el-table-column label="浏览量" align="center" prop="pageView" />
            <el-table-column label="是否收藏0否1是" align="center" prop="collectState">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.collectState"/>
              </template>
            </el-table-column>
            <el-table-column label="是否明星推荐0否1是" align="center" prop="recState">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.recommend" :value="scope.row.recState"/>
              </template>
            </el-table-column>
            <el-table-column label="预定状态0未预定1已预定" align="center" prop="reserveState">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.reserve_type" :value="scope.row.reserveState"/>
              </template>
            </el-table-column>
            <el-table-column label="VR资源" align="center" prop="vrResource" />
            <el-table-column label="园区推荐状态0否1是" align="center" prop="recomState">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.recommend" :value="scope.row.recomState"/>
              </template>
            </el-table-column>
            <el-table-column label="图片资源" align="center" prop="imgResource" />
            <el-table-column label="封面资源http:p1" align="center" prop="coverResource" />-->
      <el-table-column label="联系人" align="center" prop="contactName" />
      <!--      <el-table-column label="联系方式" align="center" prop="servicePhone" />-->
      <el-table-column label="联系方式" align="center" prop="contactPhone" />
      <!--      <el-table-column label="发布人用户ID" align="center" prop="supplyUserId" />-->
      <el-table-column label="审核状态" align="center" prop="approvalState" >
        <template slot-scope="scope">
          <dict-tag :options="dict.type.audit_status" :value="scope.row.approvalState"/>
        </template>
      </el-table-column>
      <!--      <el-table-column label="审核备注" align="center" prop="approvalNote" />
            <el-table-column label="备注" align="center" prop="note" />
            <el-table-column label="排序" align="center" prop="sort" />
            <el-table-column label="状态0有效1失效" align="center" prop="state" />
            <el-table-column label="是否删除0否1是" align="center" prop="dr" />
            <el-table-column label="VR封面" align="center" prop="vrcover" />
            <el-table-column label="是否置顶0：否1：是" align="center" prop="top" />-->
      <el-table-column width="220" fixed="right" label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleLook(scope.row)"
          >预览
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['myIndustry:auction:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            style=""
            @click="handleDelete(scope.row)"
            v-hasPermi="['myIndustry:auction:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改项目-拍卖对话框 -->
    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="759px" append-to-body center>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px" style="margin-left: 2%; margin-right: 2%">
        <el-form-item label="拍卖名称" prop="auctionName" >
          <el-input v-model="form.auctionName" placeholder="请输入拍卖名称" class="auction" maxlength="50"/>
        </el-form-item>

        <el-row>
          <el-col :span="24">
            <el-form-item label="所属城市" prop="auctionArea" >
              <el-select v-model="form.provinceId" placeholder="请选择省份" style="width: 30%"
                         @change="getCityList(form.provinceId)" clearable >
                <el-option
                  v-for="dict in provinces"
                  :key="dict.id"
                  :label="dict.name"
                  :value="dict.id"
                />
              </el-select>
              <el-select v-model="form.cityId" placeholder="请选择城市"
                         :disabled="form.provinceId==null||form.provinceId===''"
                         @change="getAreaList(form.cityId)"
                         style="width: 30%" clearable>
                <el-option
                  v-for="dict in citys"
                  :key="dict.id"
                  :label="dict.name"
                  :value="dict.id"
                />
              </el-select>
              <el-select v-model="form.areaId" placeholder="请选择区域"
                         :disabled="form.cityId==null||form.cityId===''"
                         style="width: 30%"
                         @change="getArea()"
                         clearable>
                <el-option
                  v-for="dict in areas"
                  :key="dict.id"
                  :label="dict.name"
                  :value="dict.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="标的所在地" prop="auctionAddress">
              <el-input v-model="form.auctionAddress" placeholder="请输入标的所在地" class="auction" maxlength="50"/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="拍卖类型" prop="auctionType">
              <el-select v-model="form.auctionType" placeholder="请选择拍卖类型" class="auction">
                <el-option
                  v-for="dict in dict.type.auction_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="资产类型" prop="auctionAssets">
              <el-select v-model="form.auctionAssets" placeholder="请选择资产类型" class="auction">
                <el-option
                  v-for="dict in dict.type.asset_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="建筑总面积" prop="allSize" >
              <el-input v-model="form.allSize" oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="50"
                        placeholder="请输入总面积" class="auction">
                <template slot="append">平方公里</template>
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="拍卖状态" prop="auctionState">
              <el-select v-model="form.auctionState" placeholder="请选择拍卖状态" class="auction">
                <el-option
                  v-for="dict in dict.type.auction_state"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="拍卖阶段" prop="auctionStage">
              <el-select v-model="form.auctionStage" placeholder="请选择拍卖阶段" class="auction">
                <el-option
                  v-for="dict in dict.type.auction_stage"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="上拍时间" prop="auctionTime" >
              <el-date-picker clearable class="auction"
                              v-model="form.auctionTime"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择上拍时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="起拍价格" prop="auctionPriceLower" style="width: 100%">
          <!--          <el-input v-model="form.auctionPrice" placeholder="请输入价格区间" />-->
          <el-input
            v-model="form.auctionPriceLower"
            placeholder="请输入起拍价格"
            oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="50"
            class="auction"
            clearable
          >
            <template slot="append">元</template>
          </el-input>
        </el-form-item>
        <el-form-item label="保证金" prop="auctionPriceUpper" style="width: 100%">
          <el-input
            v-model="form.auctionPriceUpper"
            placeholder="请输入保证金"
            oninput="value=value.replace(/[^0-9.]/g,'')" maxlength="50"
            class="auction"
            clearable
          >
            <template slot="append">元</template>
          </el-input>
        </el-form-item>
        <!--        <el-form-item label="园区ID" prop="parkId">
                  <el-select v-model="form.parkId" placeholder="请选择园区ID">
                    <el-option
                      v-for="dict in dict.type.sys_user_sex"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="所属城市ID" prop="cityId">
                  <el-input v-model="form.cityId" placeholder="请输入所属城市ID" />
                </el-form-item>

                <el-form-item label="浏览量" prop="pageView">
                  <el-input v-model="form.pageView" placeholder="请输入浏览量" />
                </el-form-item>-->
<!--        <el-row>
          <el-col :span="24">
            <el-form-item label="是否收藏" prop="collectState">
              <el-select v-model="form.collectState" placeholder="请选择是否收藏" class="auction">
                <el-option
                  v-for="dict in dict.type.sys_whether"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="是否明星推荐" prop="recState">
              <el-select v-model="form.recState" placeholder="请选择是否明星推荐" class="auction">
                <el-option
                  v-for="dict in dict.type.recommend"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="预定状态" prop="reserveState">
              <el-select v-model="form.reserveState" placeholder="请选择预定状态" class="auction">
                <el-option
                  v-for="dict in dict.type.reserve_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="是否置顶" prop="top">
              <el-select v-model="form.top" placeholder="请选择是否置顶" class="auction">
                <el-option
                  v-for="dict in dict.type.sys_whether"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>-->
<!--        <el-form-item label="园区推荐状态" prop="recomState">
          <el-select v-model="form.recomState" placeholder="请选择园区推荐状态" class="auction">
            <el-option
              v-for="dict in dict.type.recommend"
              :key="dict.value"
              :label="dict.label"
              :value="parseInt(dict.value)"
            ></el-option>
          </el-select>
        </el-form-item>-->
        <el-form-item label="VR资源" prop="vrResource" :disabled="title==='审核园区信息'">
<!--          <file-upload v-model="form.vrResource"/>-->
          <video-upload v-model="form.vrResource"/>
        </el-form-item>
        <el-form-item label="图片资源" prop="imgResource" :disabled="title==='审核园区信息'">
          <image-upload v-model="form.imgResource"/>
        </el-form-item>
        <el-form-item label="VR封面" prop="vrcover" :disabled="title==='审核园区信息'">
          <image-upload v-model="form.vrcover" :limit="1"/>
        </el-form-item>
        <el-form-item label="微信二维码" prop="qrCode">
          <image-upload v-model="form.qrCode" :limit="1"/>
        </el-form-item>
        <el-form-item label="封面资源" prop="coverResource" :disabled="title==='审核园区信息'">
          <image-upload v-model="form.coverResource" :limit="1"/>
        </el-form-item>
        <el-form-item label="联系人" prop="contactName">
          <el-input v-model="form.contactName" placeholder="请输入联系人" class="auction" maxlength="50"/>
        </el-form-item>
        <el-form-item label="联系方式" prop="servicePhone">
          <el-input v-model="form.servicePhone" placeholder="请输入联系方式" class="auction"  maxlength="50"/>
        </el-form-item>
        <!--        <el-form-item label="发布人用户ID" prop="supplyUserId">-->
        <!--          <el-input v-model="form.supplyUserId" placeholder="请输入发布人用户ID" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="审核状态" prop="approvalState">-->
        <!--          <el-select v-model="form.recomState" placeholder="请选择审核状态">-->
        <!--            <el-option-->
        <!--              v-for="dict in dict.type.recommend"-->
        <!--              :key="dict.value"-->
        <!--              :label="dict.label"-->
        <!--              :value="parseInt(dict.value)"-->
        <!--            ></el-option>-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="审核意见" prop="approvalNote">-->
        <!--          <el-input v-model="form.approvalNote" placeholder="请输入审核意见" />-->
        <!--        </el-form-item>-->
        <el-form-item label="备注" prop="note">
          <el-input v-model="form.note" type="textarea" maxlength="100" show-word-limit placeholder="请输入备注" class="auction"/>
        </el-form-item>
        <el-form-item >
          <el-alert
            title="初审通过" type="success" center :closable="false" v-if="form.approvalState===1||form.approvalState===3||form.approvalState===4" class="auction" show-icon>
          </el-alert>
          <el-alert
            title="初审拒绝" type="error" center :closable="false" v-if="form.approvalState===2" class="auction" show-icon>
          </el-alert>
        </el-form-item>
        <el-form-item label="初审意见" prop="approvalNote" v-if="form.approvalState!==0&&form.approvalState!=null">
          <editor v-model="form.approvalNote" :min-height="100" class="auction" read-only/>
        </el-form-item>
        <el-form-item>
          <el-alert title="复审通过" type="success" center :closable="false" v-if="form.approvalState===1" class="auction" show-icon>
          </el-alert>
          <el-alert title="复审拒绝" type="error" center :closable="false" v-if="form.approvalState===4" class="auction" show-icon>
          </el-alert>
        </el-form-item>
        <el-form-item label="复审意见" prop="recheckNote" v-if="form.approvalState===1||form.approvalState===4">
          <editor v-model="form.recheckNote" :min-height="100" class="auction" read-only/>
        </el-form-item>
        <!--        <el-form-item label="排序" prop="sort">-->
        <!--          <el-input v-model="form.sort" placeholder="请输入排序" />-->
        <!--        </el-form-item>-->
        <!--        <el-form-item label="状态" prop="state">
                  <el-select v-model="form.recomState" placeholder="请选择状态">
                    <el-option
                      v-for="dict in dict.type.recommend"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="是否删除" prop="dr">
                  <el-select v-model="form.recomState" placeholder="请选择是否删除">
                    <el-option
                      v-for="dict in dict.type.recommend"
                      :key="dict.value"
                      :label="dict.label"
                      :value="parseInt(dict.value)"
                    ></el-option>
                  </el-select>
                </el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 审核 -->
    <el-dialog title="拍卖审核" :visible.sync="auditSpace" close-on-click-modal center width="750px">
      <el-form :model="form" label-width="130px" >
        <el-form-item label="审核意见" prop="approvalNote" >
          <Editor v-model="form.approvalNote" :min-height="100" style="width: 85%"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="success" @click="submitCheck(1)">审核通过</el-button>
        <span style="width: 5%;display: inline-block"></span>
        <el-button type="danger" @click="submitCheck(2)">审核驳回</el-button>
        <span style="width: 5%;display: inline-block"></span>
        <el-button type="info" @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listAuction, getAuction, delAuction, addAuction, updateAuction } from "@/api/myIndustry/auction";
import {listCity} from "@/api/business/businessIntro";
import VideoUpload from "@/components/VideoUpload";
import MyEditor from "@/components/wangEdiot";

export default {
  name: "Auction",
  components: {MyEditor, VideoUpload},
  dicts: ['recommend', 'asset_type','sys_whether', 'announce_type', 'audit_status', 'reserve_type', 'sys_yes_no', 'auction_stage', 'sys_user_sex', 'auction_type', 'auction_state'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      //省份
      provinces: [],
      province: null,
      //城市
      citys: [],
      city: null,
      //区域
      areas: [],
      area: null,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 项目-拍卖表格数据
      auctionList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      auditSpace: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        auctionName: null,
        auctionType: null,
        auctionArea: null,
        allSize: null,
        auctionAddress: null,
        auctionAssets: null,
        auctionState: null,
        auctionStage: null,
        auctionTime: null,
        auctionPriceLower: null,
        auctionPriceUpper: null,
        parkId: null,
        cityId: null,
        areaId: null,
        releaseType: 1,
        pageView: null,
        collectState: null,
        recState: null,
        reserveState: null,
        vrResource: null,
        recomState: null,
        imgResource: null,
        coverResource: null,
        contactName: null,
        servicePhone: null,
        contactPhone: null,
        supplyUserId: null,
        approvalState: null,
        approvalNote: null,
        note: null,
        sort: null,
        state: null,
        dr: null,
        vrcover: null,
        top: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        auctionName: [
          { required: true, message: "拍卖名称不能为空", trigger: "blur" }
        ],
        supplyType: [
          { required: true, message: "需求类型不能为空", trigger: "blur" }
        ],
        apartmentLeasePrice: [
          { required: true, message: "租赁价格不能为空", trigger: "blur" }
        ],
        apartmentSellPrice: [
          { required: true, message: "出售价格不能为空", trigger: "blur" }
        ],
        releaseType: [
          { required: true, message: "发布类型不能为空", trigger: "blur" }
        ],
        contactName: [
          {required: true, message: "联系人不能为空", trigger: "blur"}
        ],
        contactPhone: [
          {required: true, message: "联系方式不能为空", trigger: "blur"},
          {
            required: true,
            pattern: /^[1][3,4,5,7,8,9][0-9]{9}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        // auctionType: [
        //   {required: true, message: "拍卖类型不能为空", trigger: "blur"}
        // ],
        cityId: [
          {required: true, message: "所属城市不能为空", trigger: "blur"}
        ],
        // auctionAddress: [
        //   {required: true, message: "标的所在地不能为空", trigger: "blur"}
        // ],
        // auctionAssets: [
        //   {required: true, message: "资产类型不能为空", trigger: "blur"}
        // ],
        // allSize: [
        //   {required: true, message: "建筑总面积不能为空", trigger: "blur"}
        // ],
        // auctionState: [
        //   {required: true, message: "拍卖状态不能为空", trigger: "blur"}
        // ],
        // auctionStage: [
        //   {required: true, message: "拍卖阶段不能为空", trigger: "blur"}
        // ],
        // auctionTime: [
        //   {required: true, message: "上拍时间不能为空", trigger: "blur"}
        // ],
        // auctionPriceLower: [
        //   {required: true, message: "起拍价格不能为空", trigger: "blur"}
        // ],
        // auctionPriceUpper: [
        //   {required: true, message: "保证金不能为空", trigger: "blur"}
        // ],
        // // auctionType: [
        // //   {required: true, message: "拍卖类型不能为空", trigger: "blur"}
        // // ],
        // coverResource: [
        //   {required: true, message: "封面资源不能为空", trigger: "blur"}
        // ],
        // imgResource: [
        //   {required: true, message: "图片资源不能为空", trigger: "blur"}
        // ],
      }
    };
  },
  created() {
    this.getList();
    this.getprovinceList();
  },
  methods: {
    //预览
    handleLook(row) {
      //http://120.46.220.152/#/pages/index/details?id=339&buildType=4&spaceId=dc46adbfb2944da39078f61446cd662f&provinceId=34
      // window.location.href=`http://120.46.220.152/#/pages/news/details?id=`+id
      open(`http://120.46.220.152/#/pages/index/details?id=`+row.id+`&buildType=7&spaceId=` + row.serialNumber + `&provinceId=` + row.provinceId )
    },
    /** 查询项目-拍卖列表 */
    getList() {
      this.loading = true;
      listAuction(this.queryParams).then(response => {
        this.auctionList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.auditSpace = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.province = null;
      this.city = null;
      this.area = null;
      this.form = {
        id: null,
        auctionName: null,
        auctionType: null,
        auctionArea: null,
        auctionAddress: null,
        auctionAssets: null,
        auctionState: null,
        auctionStage: null,
        auctionTime: null,
        auctionPriceLower: null,
        auctionPriceUpper: null,
        parkId: null,
        cityId: null,
        releaseType: 1,
        pageView: null,
        collectState: null,
        recState: null,
        reserveState: null,
        vrResource: null,
        recomState: null,
        imgResource: null,
        coverResource: null,
        contactName: null,
        servicePhone: null,
        contactPhone: null,
        supplyUserId: null,
        approvalState: null,
        approvalNote: null,
        note: null,
        sort: null,
        state: null,
        dr: null,
        createTime: null,
        updateTime: null,
        vrcover: null,
        top: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      if (this.$store.getters.checkState==='0'){
        this.$message({
          type: 'info',
          message: `用户信息审核中`
        });
        return
      }else if (this.$store.getters.checkState==='2'){
        this.$message({
          type: 'error',
          message: `用户信息审核失败`
        });
        return
      }else if (this.$store.getters.checkState=== '-1'){
        this.$message({
          type: 'info',
          message: `用户信息未提交`
        });
        return
      }
      this.reset();
      this.open = true;
      this.title = "添加拍卖";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getAuction(id).then(response => {
        this.form = response.data;
        if (this.form.provinceId != null) {
          listCity(this.form.provinceId).then(res => {
            this.citys = res.data;
          })
        }
        if (this.form.cityId != null) {
          listCity(this.form.cityId).then(res => {
            this.areas = res.data;
          })
        }
        this.open = true;
        this.title = "修改拍卖";
      });
    },
    /** 审核 */
    spaceAudit(row){
      this.reset();
      this.form.id = row.id
      this.auditSpace = true;
    },
    /** 提交审核 */
    submitCheck(state) {
      updateAuction({
        id: this.form.id,
        approvalState: state,
        approvalNote: this.form.approvalNote
      }).then(response => {
        this.$modal.msgSuccess("审核成功");
        this.auditSpace = false;
        this.getList();
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.province != null && this.province !== '') {
            if (this.city != null && this.city !== '') {
              if (this.area != null && this.area !== '') {
                this.form.auctionArea = this.province + '-' + this.city + '-' + this.area;
              } else {
                this.form.auctionArea = this.province + '-' + this.city;
              }
            } else {
              this.form.auctionArea = this.province;
            }
          } else {
            this.form.auctionArea = ' ';
          }
          // this.form.approvalState = 0
          if (this.form.id != null) {
            updateAuction(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addAuction(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除项目-拍卖编号为"' + ids + '"的数据项？').then(function() {
        return delAuction(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('industry/frontend/auction/export', {
        ...this.queryParams
      }, `auction_${new Date().getTime()}.xlsx`)
    },
    //查询省份列表
    getprovinceList(){
      var parentId = 0;
      listCity(parentId).then(res =>{
        this.provinces = res.data;
      })
    },
    //查询市列表
    getCityList(provinceId) {
      console.log("BBB",provinceId)
      listCity(provinceId).then(res =>{
        this.citys = res.data;
      })
      this.queryParams.cityId=null;
      if (this.form.provinceId!=null&&this.form.provinceId!=='') {
        this.provinces.forEach(i => {
          if (i.id === this.form.provinceId) {
            this.province = i.name;
          }
        })
        this.form.cityId = null;
        this.form.areaId = null;
      }else {
        this.province = null;
        this.city = null;
        this.area = null;
      }
    },
    //查询区域列表
    getAreaList(cityId) {
      // console.log("BBB",cityId)
      listCity(cityId).then(res =>{
        this.areas = res.data;
      })
      if (this.form.cityId != null && this.form.cityId !== '') {
        this.citys.forEach(i => {
          if (i.id === this.form.cityId) {
            this.city = i.name;
          }
        })
        this.form.areaId = null;
      } else {
        this.city = null;
        this.area = null;
      }
    },
    getArea(){
      if (this.form.areaId!=null&&this.form.areaId!==''){
        this.areas.forEach(i=>{
          if (i.id===this.form.areaId){
            this.area = i.name;
          }
        })
      }else {
        this.area = null;
      }
    }
  }
};
</script>
<style scoped>
.auction{
  width: 90%;
}
</style>
